﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace DBSourceToolsLib.CodeParser
{
    public class ParseNewLine : ParseObject
    {
        public const int CRLF= 1;
//        public const int CARRIAGE_RETURN = 2;

        private static Hashtable m_KeywordHash;

        public ParseNewLine(string strCrLf, int iLineIdx, int iWordIdx)
            : base(ParseObject.UNKNOWN, ParseObject.NEWLINE, false, iLineIdx, iWordIdx)
        {
            m_Value = ParseNewLine.computeValue(strCrLf);
            m_Data = Environment.NewLine;
            IsResolved = true;
        }

        public static int computeValue(string strValue)
        {
            if (m_KeywordHash.ContainsKey(strValue))
                return (int) m_KeywordHash[strValue];
            return -1;
        }
        static ParseNewLine()
        {
            m_KeywordHash = new Hashtable();
            m_KeywordHash.Add(Environment.NewLine, CRLF);

        }
        public bool IsLegal
        {
            get { return m_Value > 0; }
        }

    }
}
